package com.dds.web.controller.union;

import com.dds.common.core.controller.BaseController;
import com.dds.common.core.domain.AjaxResult;
import com.dds.common.core.page.TableDataInfo;
import com.dds.system.service.admin.IAdminUserOperationChildService;
import com.dds.system.service.union.IUnionShopIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/union/noOperation")
public class NoOperationController extends BaseController {
    @Autowired
    private IUnionShopIndexService unionShopIndexService;

    @Autowired
    private IAdminUserOperationChildService adminUserOperationChildService;

    @PreAuthorize("@ss.hasPermi('union:noOperation:list')")
    @GetMapping("/list")
    public TableDataInfo list() {
        startPage();

        return getDataTable(unionShopIndexService.selectNoOperationList());
    }

    @GetMapping("/getUserList")
    public AjaxResult getUserList(
            @RequestParam("name") String name
    ) {
        return AjaxResult.success(adminUserOperationChildService.selectAllUserList(name));
    }

    @PutMapping("/changeShopOperation")
    public AjaxResult changeShopOperation(@RequestBody Map<String, String> params) {
        return AjaxResult.success(unionShopIndexService.changeShopOperation(params));
    }
}
